package io.github.cunyu1943;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Package : io.github.cunyu1943
 * @ClassName : Prime.java
 * @CreateTime : 2022/11/27 22:28
 * @Version : 1.0
 * @Author : 村雨遥
 * @Email : 747731461@qq.com
 * @公众号 : 村雨遥
 * @Website : https://cunyu1943.github.io/JavaPark
 * @Description : 判断一个数是否为质数
 */
public class Prime {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入一个整数");

        int num = scanner.nextInt();

        boolean flag = true;

        for (int i = 2; i < num; i++) {
            if (0 == num % i) {
                flag = false;
                break;
            }
        }

        System.out.println(num + " 是一个质数：" + flag);
    }
}
